package cn.maihe.elg.operation.model.enums;

import java.util.Arrays;

/**
 * @Description
 * @Author WJH
 * @Date 2021/04/27
 */
public enum InstitutionCode {
    zhongTian("zhongTian", "中天担保公司", "100000"),
    deXing("DXDB", "得兴担保公司", "100001"),
    xianYou("XYDB", "仙游担保公司", "100002"),
    hubeiZbank("hubeiZbank", "湖北众邦银行", "000100");

    /**
     * 库表出函机构编码&出函机构入口编码标识
     */
    private String code;
    private String desc;
    /**
     * 业务标识 000000 公司(直开式、分离式) 银行（直开式、分离式） 保险公司(直开式、分离式)
     * 0未开展该业务 1已开展该业务
     */
    private String businessFlag;

    InstitutionCode(String code, String desc, String businessFlag) {
        this.code = code;
        this.desc = desc;
        this.businessFlag = businessFlag;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public String getBusinessFlag() {
        return businessFlag;
    }

    public static InstitutionCode resolve(String code) {
        return Arrays.stream(values()).filter(o -> o.getCode().equals(code)).findFirst().orElse(null);
    }
}
